import { createAction } from 'redux-actions';
import * as AgentTypes from '../types/AgentTypes';
import { login } from '../../model/LoginModel';

export const updateAgentMessage = createAction(AgentTypes.UPDATE_AGENT_MESSAGE);
export const updateAgentAuthorize = createAction(
  AgentTypes.ASYNC_UPDATE_AGENT_AUTHORIZE
);

export const asyncUpdateAgentMessage = () => {
  return (dispatch, state) => {
    login()
      .then(result => {
        console.log('Action中获取用户信息的结果 ==>', result);
      })
      .catch(err => {
        console.log(err);
      });
  };
};
